import layout from '../views/layout/layout';

//权限路由
const limitedRoutes = [
  {
    path: '/home',
    component: layout,
    redirect: '/home/homeView',
    name: 'home',
    meta: {
      title: '首页',
      icon: 'L-frontpage',
      users: ['admin', 'engineer'],
      show: false,
    },
    children: [
      {
        path: 'homeView',
        name: 'homeView',
        component: () => import('../views/pages/homeView'),
        meta: {
          title: '监控面板',
          icon: 'el-icon-s-home',
          users: ['admin', 'engineer'],
          show: true,
        },
      },
    ],
  },
  {
    path: '/device',
    component: layout,
    name: 'device',
    redirect: '/device/deviceView',
    meta: {
      title: '采集管理',
      icon: 'L-collection',
      users: ['admin', 'engineer'],
      show: false,
    },
    children: [
      {
        path: 'deviceView',
        name: 'deviceView',
        component: () => import('../views/pages/deviceView'),
        meta: {
          title: '设备管理',
          icon: 'el-icon-s-home',
          users: ['admin', 'engineer'],
          show: true,
        },
      },
      {
        path: 'scriptView',
        name: 'scriptView',
        component: () => import('../views/pages/scriptView'),
        meta: {
          title: '采集规则',
          icon: 'el-icon-s-home',
          users: ['admin', 'engineer'],
          show: true,
        },
      },
      {
        path: 'taskView',
        name: 'taskView',
        component: () => import('../views/pages/taskView'),
        meta: {
          title: '采集任务',
          icon: 'el-icon-s-home',
          users: ['admin', 'engineer'],
          show: true,
        },
      },
       {
        path: 'templateClassification',
        name: 'templateClassification',
        component: () => import('../views/pages/templateManage/templateClassification'),
        meta: {
          title: '代码模板',
          icon: 'el-icon-s-home',
          users: ['admin', 'engineer'],
          show: true,
        },
      },
    ],
  },

  {
    path: '/user',
    component: layout,
    name: 'user',
    redirect: '/user/userManage',
    meta: {
      title: '系统管理',
      icon: 'L-system',
      users: ['admin', 'engineer'],
      show: false,
    },
    children: [
      {
        path: 'userManage',
        name: 'userManage',
        component: () => import('../views/pages/userManage'),
        meta: {
          title: '用户管理',
          icon: 'el-icon-s-home',
          users: ['admin', 'engineer'],
          show: true,
        },
      },
      {
        path: 'roleManage',
        name: 'roleManage',
        component: () => import('../views/pages/roleManage'),
        meta: {
          title: '角色管理',
          icon: 'el-icon-s-home',
          users: ['admin', 'engineer'],
          show: true,
        },
      },
    ],
  },
  {
    path: '/operation',
    component: layout,
    name: 'operation',
    redirect: '/operation/operationLog',
    meta: {
      title: '运维日志',
      icon: 'L-operation',
      users: ['admin', 'engineer'],
      show: false,
    },
    children: [
      {
        path: 'operationLog',
        name: 'operationLog',
        component: () => import('../views/pages/operationLog'),
        meta: {
          title: '操作日志',
          icon: 'el-icon-s-home',
          users: ['admin', 'engineer'],
          show: true,
        },
      },
      {
        path: 'logFile',
        name: 'logFile',
        component: () => import('../views/pages/logFile'),
        meta: {
          title: '日志文件',
          icon: 'el-icon-s-home',
          users: ['admin', 'engineer'],
          show: true,
        },
      },
      {
        path: 'mesExceptionLog',
        name: 'mesExceptionLog',
        component: () => import('../views/pages/mesExceptionView'),
        meta: {
          title: 'MES交互异常',
          icon: 'el-icon-s-home',
          users: ['admin', 'engineer'],
          show: true,
        },
      },
    ],
  },
  {
    path: '/dictionary',
    component: layout,
    name: 'dictionary',
    redirect: '/dictionary/processDictionary',
    meta: {
      isSync:true,
      title: '字典管理',
      icon: 'L-dictionary',
      users: ['admin', 'engineer'],
      show: false,
    },
    children: [
      {
        path: 'processDictionary',
        name: 'processDictionary',
        component: () => import('../views/pages/processDictionary'),
        meta: {
          title: '工序字典',
          icon: 'el-icon-s-home',
          users: ['admin', 'engineer'],
          show: true,
        },
      },
      {
        path: 'equipmentClass',
        name: 'equipmentClass',
        component: () => import('../views/pages/equipmentClass'),
        meta: {
          title: '设备分类字典',
          icon: 'el-icon-s-home',
          users: ['admin', 'engineer'],
          show: true,
        },
      },
    ],
  },
  {
    path: '/reportAnalysis',
    component: layout,
    name:'reportAnalysis',
    redirect: '/reportAnalysis/alarmQuery',
    meta: {
      title: '报表分析',
      icon: 'L-report',
      users: ['admin', 'engineer'],
      show: false,
    },
    children: [
      {
        path: 'alarmQuery',
        name: 'alarmQuery',
        component: () => import('../views/pages/reportAnalysisPage/alarmQuery.vue'),
        meta: {
          title: '报警查询',
          icon: 'el-icon-s-home',
          users: ['admin', 'engineer'],
          show: true,
        },
      },
      {
        path: 'offlineAnalysis',
        name: 'offlineAnalysis',
        component: () => import('../views/pages/reportAnalysisPage/offlineAnalysis.vue'),
        meta: {
          title: '掉线分析',
          icon: 'el-icon-s-home',
          users: ['admin', 'engineer'],
          show: true,
        },
      }
    ],
  },
  //  {
  //   path: '/templateManage',
  //   component: layout,
  //   name:'templateManage',
  //   redirect: '/templateManage/templateClassification',
  //   meta: {
  //     title: '模板管理',
  //     icon: 'L-report',
  //     users: ['admin', 'engineer'],
  //     show: false,
  //   },
  //   children: [
  //     {
  //       path: 'templateClassification',
  //       name: 'templateClassification',
  //       component: () => import('../views/pages/templateManage/templateClassification'),
  //       meta: {
  //         title: '模板分类',
  //         icon: 'el-icon-s-home',
  //         users: ['admin', 'engineer'],
  //         show: true,
  //       },
  //     },
  //     {
  //       path: 'codeTemplate',
  //       name: 'codeTemplate',
  //       component: () => import('../views/pages/templateManage/codeTemplate'),
  //       meta: {
  //         title: '代码模板',
  //         icon: 'el-icon-s-home',
  //         users: ['admin', 'engineer'],
  //         show: true,
  //       },
  //     }
  //   ],
  // },
];

export const menuItems = [
  {
    path: '/home/homeView',
    name: 'homeView',
    meta: {
      title: '监控面板',
      icon: 'icon-home',
      users: ['admin', 'engineer'],
      show: true,
    },
  },
  {
    path: '/device/deviceView',
    name: 'deviceView',

    meta: {
      title: '设备管理',
      icon: 'icon-devmanage',
      users: ['admin', 'engineer'],
      show: true,
    },
  },


  {
    path: '/script/scriptView',
    name: 'scriptView',
    meta: {
      title: '采集规则',
      icon: 'icon-collectscript',
      users: ['admin', 'engineer'],
      show: true,
    },
  },
  {
    path: '/task/taskView',
    name: 'taskView',
    meta: {
      title: '采集任务',
      icon: 'icon-collecttask',
      users: ['admin', 'engineer'],
      show: true,
    },
  },
  {
    path: '/reportAnalysis/offlineAnalysis',
    name: 'offlineAnalysis',
    meta: {
      title: '报表分析',
      icon: 'icon-logmsg',
      users: ['admin', 'engineer'],
      show: true,
    },
  },
  {
    path: '/reportAnalysis/alarmQuery',
    name: 'alarmQuery',
    meta: {
      title: '报警查询',
      icon: 'icon-logmsg',
      users: ['admin', 'engineer'],
      show: true,
    },
  },
  {
    path: '/user/userManageView',
    name: 'userManageView',
    meta: {
      title: '用户管理',
      icon: 'icon-usermanage',
      users: ['admin', 'engineer'],
      show: true,
    },
  },
  {
    path: '/operation/operationLog',
    name: 'operationLog',
    meta: {
      title: '操作日志',
      icon: 'icon-logoper',
      users: ['admin', 'engineer'],
      show: true,
    },
  },
  {
    path: '/operation/logFile',
    name: 'logFile',
    meta: {
      title: '日志文件',
      icon: 'icon-logmsg',
      users: ['admin', 'engineer'],
      show: true,
    },
  },
  {
    path: '/operation/mesExceptionLog',
    name: 'mesExceptionLog',
    meta: {
      title: 'MES交互异常',
      icon: 'icon-logmsg',
      users: ['admin', 'engineer'],
      show: true,
    },
  },
  {
    path: '/Dictionary/processDictionary',
    name: 'processDictionary',
    meta: {
      title: '工序字典',
      icon: 'icon-logmsg',
      users: ['admin', 'engineer'],
      show: true,
    },
  },
  {
    path: '/user/roleManage',
    name: 'roleManage',
    meta: {
      title: '角色管理',
      icon: 'icon-logmsg',
      users: ['admin', 'engineer'],
      show: true,
    },
  },
];

export const menus = [
  {
    menuid: 1,
    menukey: "homeView",
    parentid: 0,
    orderid: 1,
    route: "/home/homeView"
  },
  {
    menuid: 1,
    menukey: "home",
    parentid: 0,
    orderid: 1,
    route: "/home/homeView"
  },
  {
    menuid: 2,
    menukey: "device",
    parentid: 0,
    orderid: 1,
    route: "/device/deviceView"
  },
  {
    menuid: 2,
    menukey: "reportAnalysis",
    parentid: 0,
    orderid: 1,
    route: "/reportAnalysis/alarmQuery"
  },
  {
    menuid: 3,
    menukey: "alarmQuery",
    parentid: 2,
    orderid: 2,
    route: "/reportAnalysis/alarmQuery"
  },
  {
    menuid: 3,
    menukey: "offlineAnalysis",
    parentid: 2,
    orderid: 2,
    route: "/reportAnalysis/offlineAnalysis"
  },
  {
    menuid: 3,
    menukey: "mesExceptionLog",
    parentid: 2,
    orderid: 2,
    route: "/operation/mesExceptionLog"
  },
  {
    menuid: 3,
    menukey: "scriptView",
    parentid: 2,
    orderid: 2,
    route: "/device/scriptView"
  },
  {
    menuid: 4,
    menukey: "taskView",
    parentid: 2,
    orderid: 3,
    route: "/device/taskView"
  },
  {
    menuid: 5,
    menukey: "deviceView",
    parentid: 2,
    orderid: 1,
    route: "/device/deviceView"
  },
  {
    menuid: 5,
    menukey: "user",
    parentid: 2,
    orderid: 1,
    route: "/user/userManage"
  },
  {
    menuid: 5,
    menukey: "userManage",
    parentid: 2,
    orderid: 1,
    route: "/user/userManage"
  },
  {
    menuid: 5,
    menukey: "userManage",
    parentid: 2,
    orderid: 1,
    route: "/user/userManage"
  },
  {
    menuid: 5,
    menukey: "roleManage",
    parentid: 2,
    orderid: 1,
    route: "/user/roleManage"
  },
  {
    menuid: 5,
    menukey: "operation",
    parentid: 2,
    orderid: 1,
    route: "/operation/operationlog"
  },
  {
    menuid: 5,
    menukey: "operationLog",
    parentid: 2,
    orderid: 1,
    route: "/operation/operationlog"
  },

  {
    menuid: 5,
    menukey: "logFile",
    parentid: 2,
    orderid: 1,
    route: "/operation/logFile"
  },
  {
    menuid: 5,
    menukey: "dictionary",
    parentid: 2,
    orderid: 1,
    route: "/dictionary/logFile"
  },
  {
    menuid: 5,
    menukey: "processDictionary",
    parentid: 2,
    orderid: 1,
    route: "/dictionary/processDictionary"
  },
  {
    menuid: 5,
    menukey: "equipmentClass",
    parentid: 2,
    orderid: 1,
    route: "/dictionary/equipmentClass"
  },
  // {
  //   menuid: 5,
  //   menukey: "templateManage",
  //   parentid: 2,
  //   orderid: 1,
  //   route: "/templateManage/templateClassification"
  // },
 {
    menuid: 5,
    menukey: "templateClassification",
    parentid: 2,
    orderid: 1,
    route: "/device/templateClassification"
  }

];
export default limitedRoutes;
